package ctp.ctpgraph;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.Range;

import ctp.statesgraph.Policy;
import ctp.statesgraph.PolicyBuilder;
import ctp.statesgraph.StatesGraph;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.graph.SparseGraph;
import edu.uci.ics.jung.graph.Tree;

public class CTPMain {
	
	
	public static final String OPT_INPUT_TABLE    = "t"; // Use a database
	public static final String OPT_INPUT_FILE     = "f"; // Use an input file
	
	public static final String OPT_OUTPUT         = "o";
	public static final String OPT_NUM_OF_MAPPERS = "m";
	public static final String OPT_USE_CACHE      = "s";

	CTPGraph ctpGraph;
	StatesGraph stGraph;
	Set<Vertex> explorationVertices;
	Options cmdLineOptions;

	public CTPMain() {
		super();
		this.ctpGraph = new CTPGraph();
		this.stGraph  = new StatesGraph(ctpGraph);
		this.explorationVertices = new HashSet<Vertex>();
	}
	
	@SuppressWarnings("static-access")
	private void setupOptions() {
		
		cmdLineOptions = new Options();
		
		Option outputFilename = OptionBuilder.withArgName("filename")
			.withDescription("output file")
			.hasArg()
			.isRequired()
			.create(OPT_OUTPUT);

		Option numOfMappers = OptionBuilder.withArgName("number")
			.withDescription("number of mappers")
			.hasArg()
			.isRequired()
			.create(OPT_NUM_OF_MAPPERS);
		
		Option useCache = OptionBuilder
			.withDescription("use cache")
			.create(OPT_USE_CACHE);
		
		Option tableName = OptionBuilder
			.withArgName("table")
			.withDescription("input table name")
			.hasArg()
			.create(OPT_INPUT_TABLE);
		
		Option inputFileName = OptionBuilder
			.withArgName("filename")
			.withDescription("input file name")
			.hasArg()
			.create(OPT_INPUT_FILE);
		
		OptionGroup inputOptions = new OptionGroup();
		inputOptions.addOption(tableName);
		inputOptions.addOption(inputFileName);
		inputOptions.setRequired(true);
		

		cmdLineOptions.addOption(outputFilename);
		cmdLineOptions.addOption(numOfMappers);
		cmdLineOptions.addOption(useCache);

		cmdLineOptions.addOptionGroup(inputOptions);
	}	

	private void initSampleGraph() {
		/*
		 * start=v2
		 * goal=v6
         * E=v2,v5,6,0.1
		 * E=v5,v5,2,0.1
		 * E=v6,v2,1,0.4
		 * 
		 */
		Graph<Vertex, Edge> g = ctpGraph.getGraph();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		
		ctpGraph.setStart(v1);
		ctpGraph.setGoal(v6);
		
		Edge e1 = new Edge(1,   0.0, "e1");
		Edge e2 = new Edge(2,   0.2, "e2");
		Edge e3 = new Edge(1,   0.6, "e3");
		Edge e4 = new Edge(200, 0.0, "e4");
		Edge e5 = new Edge(0  , 0.0, "e5");
		Edge e6 = new Edge(0  , 0.0, "e6");
		Edge e7 = new Edge(0  , 0.0, "e7");
			    
	    g.addEdge(e1, v1, v2);
	    g.addEdge(e2, v2, v3);
	    g.addEdge(e3, v2, v4);
	    g.addEdge(e4, v1, v5);
	    g.addEdge(e5, v3, v6);
	    g.addEdge(e6, v4, v6);
	    g.addEdge(e7, v5, v6);
	    
	    Tree<Vertex, Edge> t = ctpGraph.tree;
	    t.addVertex(v1);
	    t.addEdge(e1, v1, v2);
	    t.addEdge(e2, v2, v3);
	    t.addEdge(e3, v2, v4);
	    t.addEdge(e4, v1, v5);
	    
	}
	
	
	private void initNonCommitingPolicy() {
		Graph<Vertex, Edge> g = ctpGraph.getGraph();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		
		ctpGraph.setStart(v1);
		ctpGraph.setGoal(v7);
		
		Edge e1 = new Edge(10,  0.0, "e1");
		Edge e2 = new Edge(100, 0.0, "e2");
		Edge e3 = new Edge(1000,0.0, "e3");
		Edge e4 = new Edge(1,   0.5, "e4");
		Edge e5 = new Edge(100, 0.5, "e5");
		Edge e6 = new Edge(0,   0.0, "e6");
		Edge e7 = new Edge(0,   0.0, "e7");
		Edge e8 = new Edge(0,   0.0, "e8");
		
	    g.addEdge(e1, v1, v2);
	    g.addEdge(e2, v1, v3);
	    g.addEdge(e3, v2, v4);
	    g.addEdge(e4, v2, v5);
	    g.addEdge(e5, v3, v6);
	    g.addEdge(e6, v4, v7);
	    g.addEdge(e7, v5, v7);
	    g.addEdge(e8, v6, v7);
	    
	    Tree<Vertex, Edge> t = ctpGraph.tree;
	    t.addVertex(v1);
	    t.addEdge(e1, v1, v2);
	    t.addEdge(e2, v1, v3);
	    t.addEdge(e3, v2, v4);
	    t.addEdge(e4, v2, v5);
	    t.addEdge(e5, v3, v6);

	}

	private void initCommitingPolicy() {
		Graph<Vertex, Edge> g = ctpGraph.getGraph();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		
		ctpGraph.setStart(v1);
		ctpGraph.setGoal(v7);
		
		Edge e1 = new Edge(1,   0.0, "e1");
		Edge e2 = new Edge(2,   0.2, "e2");
		Edge e3 = new Edge(2,   0.0, "e3");
		Edge e4 = new Edge(3,   0.1, "e4");
		Edge e5 = new Edge(200, 0.0, "e5");
		Edge e6 = new Edge(0,   0.0, "e6");
		Edge e7 = new Edge(0,   0.0, "e7");
		Edge e8 = new Edge(0,   0.0, "e8");
		
	    g.addEdge(e1, v1, v2);
	    g.addEdge(e2, v2, v4);
	    g.addEdge(e3, v1, v3);
	    g.addEdge(e4, v3, v5);
	    g.addEdge(e5, v1, v6);
	    g.addEdge(e6, v4, v7);
	    g.addEdge(e7, v5, v7);
	    g.addEdge(e8, v6, v7);
	    
	    Tree<Vertex, Edge> t = ctpGraph.tree;
	    t.addVertex(v1);
	    t.addEdge(e1, v1, v2);
	    t.addEdge(e2, v2, v4);
	    t.addEdge(e3, v1, v3);
	    t.addEdge(e4, v3, v5);
	    t.addEdge(e5, v1, v6);
		
	}
	
	private void initVertexCommitingDisjoint() {
		Graph<Vertex, Edge> g = ctpGraph.getGraph();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		
		ctpGraph.setStart(v1);
		ctpGraph.setGoal(v7);
		
		Edge e1 = new Edge(1,   0.0, "e1");
		Edge e2 = new Edge(2,   0.2, "e2");
		Edge e3 = new Edge(2,   0.0, "e3");
		Edge e4 = new Edge(3,   0.1, "e4");
		Edge e5 = new Edge(200, 0.0, "e5");
		Edge e6 = new Edge(0,   0.0, "e6");
		Edge e7 = new Edge(0,   0.0, "e7");
		Edge e8 = new Edge(0,   0.0, "e8");
		
	    g.addEdge(e1, v1, v2);
	    g.addEdge(e2, v2, v4);
	    g.addEdge(e3, v1, v3);
	    g.addEdge(e4, v3, v5);
	    g.addEdge(e5, v1, v6);
	    g.addEdge(e6, v4, v7);
	    g.addEdge(e7, v5, v7);
	    g.addEdge(e8, v6, v7);
	    
	    Tree<Vertex, Edge> t = ctpGraph.tree;
	    t.addVertex(v1);
	    t.addEdge(e1, v1, v2);
	    t.addEdge(e2, v2, v4);
	    t.addEdge(e3, v1, v3);
	    t.addEdge(e4, v3, v5);
	    t.addEdge(e5, v1, v6);
	    
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
				
	}
	
	private void initTestTreeSimple() {
		Graph<Vertex, Edge> g = ctpGraph.getGraph();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6",true);
		Vertex v7 = new Vertex("v7");
		
		ctpGraph.setStart(v1);
		ctpGraph.setGoal(v7);
		
		Edge e1 = new Edge(1,   0.0, "e1");
		Edge e2 = new Edge(5,   0.3, "e2");
		Edge e3 = new Edge(2,   0.3, "e3");
		Edge e4 = new Edge(2,   0.6, "e4");
		Edge e5 = new Edge(200, 0.0, "e5");
		Edge e6 = new Edge(0,   0.0, "e6");
		Edge e7 = new Edge(0,   0.0, "e7");
		Edge e8 = new Edge(0,   0.0, "e8");
		
	    g.addEdge(e1, v1, v2);
	    g.addEdge(e2, v2, v3);
	    g.addEdge(e3, v3, v4);
	    g.addEdge(e4, v3, v5);
	    g.addEdge(e5, v1, v6);
	    g.addEdge(e6, v4, v7);
	    g.addEdge(e7, v5, v7);
	    g.addEdge(e8, v6, v7);
	    
	    Tree<Vertex, Edge> t = ctpGraph.tree;
	    t.addVertex(v1);
	    t.addEdge(e1, v1, v2);
	    t.addEdge(e2, v2, v3);
	    t.addEdge(e3, v3, v4);
	    t.addEdge(e4, v3, v5);
	    t.addEdge(e5, v1, v6);
	    
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
				
	}
	

	private void initRandomGraph() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		
		this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v4;

		Double[] values = {0.0, 0.3, 0.5};
		Double[] open   = {0.0};
		Range<Double> costRange = Range.between(0.6, 1.0);
		
		EdgeRandom e1 = new EdgeRandom(costRange, new HashSet<Double>(Arrays.asList(open)), "e1");
		EdgeRandom e2 = new EdgeRandom(costRange, new HashSet<Double>(Arrays.asList(open)), "e2");
		EdgeRandom e3 = new EdgeRandom(costRange, new HashSet<Double>(Arrays.asList(open)), "e3");
		EdgeRandom e4 = new EdgeRandom(costRange, new HashSet<Double>(Arrays.asList(open)), "e4");
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v2, v4);
		randGraph.addEdge(e4, v3, v4);
		
		ctpGraph.rollGraph(randGraph);
	}
	
	private void initRandomGraphDror() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		Vertex v8 = new Vertex("v8");
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v7;

		double[] open   = {0.0};
		double[] noCost = open;
		double[] defaultcost   = {100.0};
		
		//EdgeRandom e1  = new EdgeRandom(new double[] {1.8387}, open,               "e1");
		EdgeRandom e1  = new EdgeRandom(new double[] {0.5},    open,               "e1");
		EdgeRandom e2  = new EdgeRandom(new double[] {1.0},    open,               "e2");
		EdgeRandom e3  = new EdgeRandom(new double[] {2.0},    new double[] {0.6}, "e3");
		//EdgeRandom e4  = new EdgeRandom(new double[] {2.0},    new double[] {0.4}, "e4");
		EdgeRandom e4  = new EdgeRandom(new double[] {1000.0}, open, "e4");
		EdgeRandom e5  = new EdgeRandom(new double[] {2.0},    new double[] {0.5}, "e5");
		EdgeRandom e6  = new EdgeRandom(noCost,                open,               "e6");
		EdgeRandom e7  = new EdgeRandom(noCost,                open,               "e7");
		EdgeRandom e8  = new EdgeRandom(noCost,                open,               "e8");
		EdgeRandom e9  = new EdgeRandom(defaultcost,           open,               "e9");
		EdgeRandom e10 = new EdgeRandom(noCost,                open,               "e10");
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v2, v4);
		randGraph.addEdge(e4, v2, v5);
		randGraph.addEdge(e5, v3, v6);
		randGraph.addEdge(e6, v4, v7);
		randGraph.addEdge(e7, v5, v7);
		randGraph.addEdge(e8, v6, v7);
		randGraph.addEdge(e9, v1, v8);
		randGraph.addEdge(e10, v8, v7);
		
		
		ctpGraph.rollGraph(randGraph);
	}

	private void initExperimentA() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		Vertex v2  = new Vertex("v2");
		Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		Vertex v8  = new Vertex("v8");
		Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v15;

		double[] open   = {0.0};
		double[] noCost = open;
		
		double costMin = 0.0;
		double costMax = 20000.0;
		Range<Double> costRange = Range.between(costMin, costMax);
		
		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);

		double[] defaultcost   = {100.0 * costMax};
		
		EdgeRandom e1  = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e1");
		EdgeRandom e2  = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e2");
		EdgeRandom e3  = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e3");
		
		EdgeRandom e4  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e4");
		EdgeRandom e5  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e5");
		EdgeRandom e6  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e6");
		
		EdgeRandom e7  = new EdgeRandom(Range.between(1000.0, costMax),    probRange, "e7");
		EdgeRandom e8  = new EdgeRandom(Range.between(1000.0, costMax),    probRange, "e8");
		EdgeRandom e9  = new EdgeRandom(Range.between(1000.0, costMax),    probRange, "e9");
		EdgeRandom e10  = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e10");
		EdgeRandom e11  = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e11");
		EdgeRandom e12  = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e12");
		//EdgeRandom e12  = new EdgeRandom(Range.between(0.0, 20000.0),   probRange, "e12");
		
		EdgeRandom e13  = new EdgeRandom(defaultcost,    open, "e13");
		
		EdgeRandom e14  = new EdgeRandom(noCost, open, "e14");
		EdgeRandom e15  = new EdgeRandom(noCost, open, "e15");
		EdgeRandom e16  = new EdgeRandom(noCost, open, "e16");
		EdgeRandom e17  = new EdgeRandom(noCost, open, "e17");
		EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
		
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		
		randGraph.addEdge(e4, v2, v5);
		randGraph.addEdge(e5, v3, v6);
		randGraph.addEdge(e6, v4, v7);
		
		
		randGraph.addEdge(e7,  v5, v8);
		randGraph.addEdge(e8,  v5, v9);
		randGraph.addEdge(e9,  v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		
		randGraph.addEdge(e13,  v1, v14);
		
		randGraph.addEdge(e14,  v8, v15);		
		randGraph.addEdge(e15,  v9, v15);		
		randGraph.addEdge(e16,  v10, v15);		
		randGraph.addEdge(e17,  v11, v15);		
		randGraph.addEdge(e18,  v12, v15);		
		randGraph.addEdge(e19,  v13, v15);		
		randGraph.addEdge(e20,  v14, v15);		
		
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}	
	
	private void initExperimentADebug() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		//Vertex v2  = new Vertex("v2");
		//Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		//Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		//Vertex v8  = new Vertex("v8");
		//Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		//Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");
		
		this.explorationVertices.addAll(randGraph.getVertices());
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v15;

		double[] open   = {0.0};
		double[] noCost = open;
		double[] defaultcost   = {100.0};
		
		EdgeRandom e1  = new EdgeRandom(new double[] {1.0},    open,               "e1");
		EdgeRandom e2  = new EdgeRandom(new double[] {1.0},    open,               "e2");
		EdgeRandom e3  = new EdgeRandom(new double[] {1.0},    open,               "e3");
		
		EdgeRandom e4  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e4");
		EdgeRandom e5  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e5");
		EdgeRandom e6  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e6");
		
		EdgeRandom e7  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e7");
		EdgeRandom e8  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e8");
		EdgeRandom e9  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e9");
		EdgeRandom e10  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e10");
		EdgeRandom e11  = new EdgeRandom(new double[] {1.0},    new double[] {0.5}, "e11");
		EdgeRandom e12  = new EdgeRandom(new double[] {1.0, 20000.0},    new double[] {0.5}, "e12");
		
		EdgeRandom e13  = new EdgeRandom(defaultcost,    open, "e13");
		
		EdgeRandom e14  = new EdgeRandom(noCost, open, "e14");
		EdgeRandom e15  = new EdgeRandom(noCost, open, "e15");
		EdgeRandom e16  = new EdgeRandom(noCost, open, "e16");
		EdgeRandom e17  = new EdgeRandom(noCost, open, "e17");
		EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
		
		
		//randGraph.addEdge(e1, v1, v2);
		//randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e2, v1, v6);
		randGraph.addEdge(e3, v1, v4);
		
		//randGraph.addEdge(e4, v2, v5);
		//randGraph.addEdge(e5, v3, v6);
		randGraph.addEdge(e6, v4, v7);
		
		
		//randGraph.addEdge(e7,  v5, v8);
		//randGraph.addEdge(e8,  v5, v9);
		randGraph.addEdge(e9,  v6, v10);
		//randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		
		randGraph.addEdge(e13,  v1, v14);
		
		//randGraph.addEdge(e14,  v8, v15);		
		//randGraph.addEdge(e15,  v9, v15);		
		randGraph.addEdge(e16,  v10, v15);		
		//randGraph.addEdge(e17,  v11, v15);		
		randGraph.addEdge(e18,  v12, v15);		
		randGraph.addEdge(e19,  v13, v15);		
		randGraph.addEdge(e20,  v14, v15);		
		
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateCostBlockedSubtree();
	}
	
	private void initExperimentB() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		Vertex v2  = new Vertex("v2");
		Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		Vertex v8  = new Vertex("v8");
		Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		//Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");

		//Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18");
		//Vertex v19 = new Vertex("v19");
		Vertex v20 = new Vertex("v20");
		Vertex v21 = new Vertex("v21");
		//Vertex v22 = new Vertex("v22");
		Vertex v23 = new Vertex("v23");
		Vertex v24 = new Vertex("v24");
		Vertex v25 = new Vertex("v25");
		Vertex v26 = new Vertex("v26");
		Vertex v27 = new Vertex("v27");
		//Vertex v28 = new Vertex("v28");
		Vertex v29 = new Vertex("v29",true);
		Vertex v30 = new Vertex("v30");
		
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v30;
			
		double costMin = 0.0;
		double costMax = 20000.0;

		double[] open   = {0.0};
		double[] noCost = open;
		double[] maxCost = {costMax};
		
		Range<Double> costRange = Range.between(costMin, costMax);
		
		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
	
		double[] defaultcost   = {100.0 * costMax};
		
		EdgeRandom e1  = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e1");
		EdgeRandom e2  = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e2");
		EdgeRandom e3  = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e3");
		
		EdgeRandom e4   = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e4");
		EdgeRandom e5   = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e5");
		EdgeRandom e6   = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e6");
		EdgeRandom e7   = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e7");
		EdgeRandom e8   = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e8");
		EdgeRandom e9   = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e9");
		EdgeRandom e10  = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e10");
		EdgeRandom e11  = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e11");
		//EdgeRandom e12  = new EdgeRandom(Range.between(1000.0, costMax),   probRange, "e12");
		EdgeRandom e13  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e13");
		EdgeRandom e14  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e14");
		//EdgeRandom e15  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e15");
		EdgeRandom e16  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e16");
		EdgeRandom e17  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e17");
		//EdgeRandom e18  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e18");
		EdgeRandom e19  = new EdgeRandom(Range.between(costMin, 500.0),    open, "e19");
		EdgeRandom e20  = new EdgeRandom(Range.between(costMin, 500.0),    open, "e20");
		//EdgeRandom e21  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e21");
		EdgeRandom e22  = new EdgeRandom(Range.between(costMin, 500.0),    open, "e22");		
		EdgeRandom e23  = new EdgeRandom(Range.between(costMin, 500.0),    open, "e23");
		//EdgeRandom e24  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e24");
		EdgeRandom e25  = new EdgeRandom(Range.between(costMin, 500.0),    open, "e25");
		EdgeRandom e26  = new EdgeRandom(Range.between(costMin, 500.0),    open, "e26");
		//EdgeRandom e27  = new EdgeRandom(Range.between(costMin, 500.0),    probRange, "e27");
	
		
		EdgeRandom e28  = new EdgeRandom(noCost, open, "e28");
		EdgeRandom e29  = new EdgeRandom(noCost, open, "e29");
		//EdgeRandom e30  = new EdgeRandom(noCost, open, "e30");
		EdgeRandom e31  = new EdgeRandom(noCost, open, "e31");
		EdgeRandom e32  = new EdgeRandom(noCost, open, "e32");
		//EdgeRandom e33  = new EdgeRandom(noCost, open, "e33");
		EdgeRandom e34  = new EdgeRandom(noCost, open, "e34");
		EdgeRandom e35  = new EdgeRandom(noCost, open, "e35");
		//EdgeRandom e36  = new EdgeRandom(noCost, open, "e36");
		EdgeRandom e37  = new EdgeRandom(noCost, open, "e37");
		EdgeRandom e38  = new EdgeRandom(noCost, open, "e38");
		//EdgeRandom e39  = new EdgeRandom(noCost, open, "e39");
		EdgeRandom e40  = new EdgeRandom(noCost, open, "e40");
		EdgeRandom e41  = new EdgeRandom(noCost, open, "e41");
		//EdgeRandom e42  = new EdgeRandom(noCost, open, "e42");
		EdgeRandom e43  = new EdgeRandom(noCost, open, "e43");
		EdgeRandom e44  = new EdgeRandom(noCost, open, "e44");
		//EdgeRandom e45  = new EdgeRandom(noCost, open, "e45");
		
		EdgeRandom e46  = new EdgeRandom(maxCost, open, "e46");
		EdgeRandom e47  = new EdgeRandom(noCost, open, "e47");

		
		
		
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		
		randGraph.addEdge(e4, v2, v5);
		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v3, v8);
		randGraph.addEdge(e8, v4, v9);
		randGraph.addEdge(e9, v4, v10);
		
		randGraph.addEdge(e10, v5, v11);
		randGraph.addEdge(e11, v5, v12);
		//randGraph.addEdge(e12, v5, v13);
		randGraph.addEdge(e13, v6, v14);
		randGraph.addEdge(e14, v6, v15);		
		//randGraph.addEdge(e15, v6, v16);		
		randGraph.addEdge(e16, v7, v17);		
		randGraph.addEdge(e17, v7, v18);		
		//randGraph.addEdge(e18, v7, v19);		
		randGraph.addEdge(e19, v8, v20);		
		randGraph.addEdge(e20, v8, v21);
		//randGraph.addEdge(e21, v8, v22);
		randGraph.addEdge(e22, v9, v23);
		randGraph.addEdge(e23, v9, v24);
		//randGraph.addEdge(e24, v9, v25);		
		randGraph.addEdge(e25, v10, v26);		
		randGraph.addEdge(e26, v10, v27);		
		//randGraph.addEdge(e27, v10, v28);
		
		randGraph.addEdge(e28,  v11, v30);		
		randGraph.addEdge(e29,  v12, v30);
		//randGraph.addEdge(e30,  v13, v30);		
		randGraph.addEdge(e31,  v14, v30);		
		randGraph.addEdge(e32,  v15, v30);
		//randGraph.addEdge(e33,  v16, v30);		
		randGraph.addEdge(e34,  v17, v30);		
		randGraph.addEdge(e35,  v18, v30);
		//randGraph.addEdge(e36,  v19, v30);		
		randGraph.addEdge(e37,  v20, v30);		
		randGraph.addEdge(e38,  v21, v30);		
		//randGraph.addEdge(e39,  v22, v30);
		randGraph.addEdge(e40,  v23, v30);		
		randGraph.addEdge(e41,  v24, v30);		
		//randGraph.addEdge(e42,  v25, v30);
		randGraph.addEdge(e43,  v26, v30);		
		randGraph.addEdge(e44,  v27, v30);		
		//randGraph.addEdge(e45,  v28, v30);
		
		randGraph.addEdge(e46,  v1,  v29);		
		randGraph.addEdge(e47,  v29, v30);		
		

		
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}

	private void initExperimentC() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		Vertex v2  = new Vertex("v2");
		Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		Vertex v8  = new Vertex("v8");
		Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");
	
		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18",true);
		Vertex v19 = new Vertex("v19");
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v19;
			
		double costMin = 0.0;
		double costMax = 20000.0;
	
		double[] open   = {0.0};
		double[] noCost = open;
		double[] maxCost = {costMax};
		
		Range<Double> costRange = Range.between(costMin, costMax);
		
		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
	
		double[] defaultcost   = {100.0 * costMax};
		
		EdgeRandom e1   = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e1");
		EdgeRandom e2   = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e2");
		EdgeRandom e3   = new EdgeRandom(Range.between(costMin, 500.0),    open,               "e3");		
		EdgeRandom e4   = new EdgeRandom(Range.between(costMin, 500.0),   open, "e4");
		EdgeRandom e5   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e5");
		EdgeRandom e6   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e6");
		EdgeRandom e7   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e7");
		EdgeRandom e8   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e8");
		EdgeRandom e9   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e9");
		EdgeRandom e10  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e10");
		EdgeRandom e11  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e11");
		EdgeRandom e12  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e12");
		EdgeRandom e13  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e13");
		EdgeRandom e14  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e14");
		EdgeRandom e15  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e15");
		EdgeRandom e16  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e16");
		EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
		
		EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);
		
		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);
		
		randGraph.addEdge(e9,  v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);		
		randGraph.addEdge(e15, v9, v16);		
		randGraph.addEdge(e16, v9, v17);
		
		randGraph.addEdge(e17, v1, v18);
		
		randGraph.addEdge(e18, v10, v19);		
		randGraph.addEdge(e19, v11, v19);		
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);		
		randGraph.addEdge(e25, v17, v19);		
		randGraph.addEdge(e26, v18, v19);				
	
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}

	private void initExperimentD() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		Vertex v2  = new Vertex("v2");
		Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		Vertex v8  = new Vertex("v8");
		Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");
	
		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18",true);
		Vertex v19 = new Vertex("v19");
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v19;
			
		double costMin = 0.0;
		double costMax = 20000.0;
	
		double[] open   = {0.0};
		double[] noCost = open;
		double[] maxCost = {costMax};
		
		Range<Double> costRange = Range.between(costMin, costMax);
		
		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
		Range<Double> probRange2 = Range.between(0.6, 0.95);
	
		double[] defaultcost   = {100.0 * costMax};
		
		EdgeRandom e1  = new EdgeRandom(Range.between(costMin,    5.0), open, "e1");
		EdgeRandom e2  = new EdgeRandom(Range.between(costMin,    5.0), open, "e2");
		EdgeRandom e3  = new EdgeRandom(Range.between(costMin,    5.0), open, "e3");		
		EdgeRandom e4  = new EdgeRandom(Range.between(costMin,    5.0), open, "e4");
		
		EdgeRandom e5   = new EdgeRandom(Range.between(costMin,   5.0), probRange, "e5");
		EdgeRandom e6   = new EdgeRandom(Range.between(costMin,   5.0), probRange, "e6");
		EdgeRandom e7   = new EdgeRandom(Range.between(costMin,   5.0), probRange, "e7");
		EdgeRandom e8   = new EdgeRandom(Range.between(costMin,   5.0), probRange, "e8");
		
		EdgeRandom e9   = new EdgeRandom(Range.between(costMin,   5.0), probRange2, "e9");
		EdgeRandom e10  = new EdgeRandom(Range.between( 1000.0,  500.0), probRange, "e10");
		EdgeRandom e11  = new EdgeRandom(Range.between(costMin,   5.0), probRange2, "e11");
		EdgeRandom e12  = new EdgeRandom(Range.between( 1000.0,  500.0), probRange, "e12");
		EdgeRandom e13  = new EdgeRandom(Range.between(costMin,   5.0), probRange2, "e13");
		EdgeRandom e14  = new EdgeRandom(Range.between( 1000.0,  500.0), probRange, "e14");
		EdgeRandom e15  = new EdgeRandom(Range.between(costMin,   5.0), probRange2, "e15");
		EdgeRandom e16  = new EdgeRandom(Range.between( 1000.0,  500.0), probRange, "e16");
		EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
		
		EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);
		
		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);
		
		randGraph.addEdge(e9,  v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);		
		randGraph.addEdge(e15, v9, v16);		
		randGraph.addEdge(e16, v9, v17);
		
		randGraph.addEdge(e17, v1, v18);
		
		randGraph.addEdge(e18, v10, v19);		
		randGraph.addEdge(e19, v11, v19);		
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);		
		randGraph.addEdge(e25, v17, v19);		
		randGraph.addEdge(e26, v18, v19);				
	
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}

	private void initExperimentE() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		Vertex v2  = new Vertex("v2");
		Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		Vertex v8  = new Vertex("v8");
		Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");
	
		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18",true);
		Vertex v19 = new Vertex("v19");
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v19;
			
		double costMin = 0.0;
		double costMax = 20000.0;
	
		double[] open   = {0.0};
		double[] noCost = open;
		double[] maxCost = {costMax};
		
		Range<Double> costRange = Range.between(costMin, costMax);
		
		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
	
		double[] defaultcost   = {100.0 * costMax};
		
		EdgeRandom e1  = new EdgeRandom(Range.between(costMin, 10.0),    open,               "e1");
		EdgeRandom e2  = new EdgeRandom(Range.between(costMin, 10.0),    open,               "e2");
		EdgeRandom e3  = new EdgeRandom(Range.between(costMin, 10.0),    open,               "e3");		
		EdgeRandom e4  = new EdgeRandom(Range.between(costMin, 10.0),   open, "e4");
		
		EdgeRandom e5   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e5");
		EdgeRandom e6   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e6");
		EdgeRandom e7   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e7");
		EdgeRandom e8   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e8");
		EdgeRandom e9   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e9");
		EdgeRandom e10  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e10");
		EdgeRandom e11  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e11");
		EdgeRandom e12  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e12");
		EdgeRandom e13  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e13");
		EdgeRandom e14  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e14");
		EdgeRandom e15  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e15");
		EdgeRandom e16  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e16");
		EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
		
		EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);
		
		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);
		
		randGraph.addEdge(e9,  v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);		
		randGraph.addEdge(e15, v9, v16);		
		randGraph.addEdge(e16, v9, v17);
		
		randGraph.addEdge(e17, v1, v18);
		
		randGraph.addEdge(e18, v10, v19);		
		randGraph.addEdge(e19, v11, v19);		
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);		
		randGraph.addEdge(e25, v17, v19);		
		randGraph.addEdge(e26, v18, v19);				
	
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}

	private void initExperimentF() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
		
		Vertex v1  = new Vertex("v1");
		Vertex v2  = new Vertex("v2");
		Vertex v3  = new Vertex("v3");
		Vertex v4  = new Vertex("v4");
		Vertex v5  = new Vertex("v5");
		Vertex v6  = new Vertex("v6");
		Vertex v7  = new Vertex("v7");
		Vertex v8  = new Vertex("v8");
		Vertex v9  = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");
	
		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18",true);
		Vertex v19 = new Vertex("v19");
		
		//this.explorationVertices.add(v1);
		
		ctpGraph.start = v1;
		ctpGraph.goal  = v19;
			
		double costMin = 0.0;
		double costMax = 20000.0;
	
		double[] open   = {0.0};
		double[] noCost = open;
		double[] maxCost = {costMax};
		
		Range<Double> costRange = Range.between(costMin, costMax);
		
		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
	
		double[] defaultcost   = {100.0 * costMax};
		
		EdgeRandom e1  = new EdgeRandom(Range.between(costMin, 5.0),   open,               "e1");
		EdgeRandom e2  = new EdgeRandom(Range.between(costMin, 5.0),   open,               "e2");
		EdgeRandom e3  = new EdgeRandom(Range.between(costMin, 5.0),   open,               "e3");		
		EdgeRandom e4  = new EdgeRandom(Range.between(costMin, 5.0),   open, "e4");
		
		EdgeRandom e5   = new EdgeRandom(Range.between(costMin, 5.0), probRange, "e5");
		EdgeRandom e6   = new EdgeRandom(Range.between(costMin, 5.0), probRange, "e6");
		EdgeRandom e7   = new EdgeRandom(Range.between(costMin, 5.0), probRange, "e7");
		EdgeRandom e8   = new EdgeRandom(Range.between(costMin, 5.0), probRange, "e8");
		EdgeRandom e9   = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e9");
		EdgeRandom e10  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e10");
		EdgeRandom e11  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e11");
		EdgeRandom e12  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e12");
		EdgeRandom e13  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e13");
		EdgeRandom e14  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e14");
		EdgeRandom e15  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e15");
		EdgeRandom e16  = new EdgeRandom(Range.between(costMin, 500.0), probRange, "e16");
		EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
		
		EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
		
		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);
		
		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);
		
		randGraph.addEdge(e9,  v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);		
		randGraph.addEdge(e15, v9, v16);		
		randGraph.addEdge(e16, v9, v17);
		
		randGraph.addEdge(e17, v1, v18);
		
		randGraph.addEdge(e18, v10, v19);		
		randGraph.addEdge(e19, v11, v19);		
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);		
		randGraph.addEdge(e25, v17, v19);		
		randGraph.addEdge(e26, v18, v19);				
	
		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}

        private void initExperimentE1() {
                Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
                
                Vertex v1  = new Vertex("v1");
                Vertex v2  = new Vertex("v2");
                Vertex v3  = new Vertex("v3");
                Vertex v4  = new Vertex("v4");
                Vertex v5  = new Vertex("v5");
                Vertex v6  = new Vertex("v6");
                Vertex v7  = new Vertex("v7");
                Vertex v8  = new Vertex("v8");
                Vertex v9  = new Vertex("v9");
                Vertex v10 = new Vertex("v10");
                Vertex v11 = new Vertex("v11");
                Vertex v12 = new Vertex("v12");
                Vertex v13 = new Vertex("v13");
                Vertex v14 = new Vertex("v14");
                Vertex v15 = new Vertex("v15");
        
                Vertex v16 = new Vertex("v16");
                Vertex v17 = new Vertex("v17");
                Vertex v18 = new Vertex("v18",true);
                Vertex v19 = new Vertex("v19");
                
                //this.explorationVertices.add(v1);
                
                ctpGraph.start = v1;
                ctpGraph.goal  = v19;
                        
                double costMin = 0.0;
                double costMax = 20000.0;
        
                double[] open   = {0.0};
                double[] noCost = open;
                double[] maxCost = {costMax};
                
                Range<Double> costRange = Range.between(costMin, costMax);
                
                double probMid = 0.5;
                double probDev = 0.4;
                Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
                Range<Double> probRange2 = Range.between(0.6, 0.95);
        
                double[] defaultcost   = {100.0 * costMax};
                
                EdgeRandom e1  = new EdgeRandom(Range.between(5.0,    35.0), open, "e1");
                EdgeRandom e2  = new EdgeRandom(Range.between(5.0,    35.0), open, "e2");
                EdgeRandom e3  = new EdgeRandom(Range.between(5.0,    35.0), open, "e3");            
                EdgeRandom e4  = new EdgeRandom(Range.between(5.0,    35.0), open, "e4");
                
                EdgeRandom e5   = new EdgeRandom(Range.between(20.0,   60.0), Range.between(0.65, 0.95), "e5");
                EdgeRandom e6   = new EdgeRandom(Range.between(20.0,   60.0), Range.between(0.65, 0.95), "e6");
                EdgeRandom e7   = new EdgeRandom(Range.between(20.0,   60.0), Range.between(0.65, 0.95), "e7");
                EdgeRandom e8   = new EdgeRandom(Range.between(20.0,   60.0), Range.between(0.65, 0.95), "e8");
                
                EdgeRandom e9   = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e9");
                EdgeRandom e10  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e10");
                EdgeRandom e11  = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e11");
                EdgeRandom e12  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e12");
                EdgeRandom e13  = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e13");
                EdgeRandom e14  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e14");
                EdgeRandom e15  = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e15");
                EdgeRandom e16  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e16");
                EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
                
                EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
                EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
                EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
                EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
                EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
                EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
                EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
                EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
                EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
                
                randGraph.addEdge(e1, v1, v2);
                randGraph.addEdge(e2, v1, v3);
                randGraph.addEdge(e3, v1, v4);
                randGraph.addEdge(e4, v1, v5);
                
                randGraph.addEdge(e5, v2, v6);
                randGraph.addEdge(e6, v3, v7);
                randGraph.addEdge(e7, v4, v8);
                randGraph.addEdge(e8, v5, v9);
                
                randGraph.addEdge(e9,  v6, v10);
                randGraph.addEdge(e10, v6, v11);
                randGraph.addEdge(e11, v7, v12);
                randGraph.addEdge(e12, v7, v13);
                randGraph.addEdge(e13, v8, v14);
                randGraph.addEdge(e14, v8, v15);                
                randGraph.addEdge(e15, v9, v16);                
                randGraph.addEdge(e16, v9, v17);
                
                randGraph.addEdge(e17, v1, v18);
                
                randGraph.addEdge(e18, v10, v19);               
                randGraph.addEdge(e19, v11, v19);               
                randGraph.addEdge(e20, v12, v19);
                randGraph.addEdge(e21, v13, v19);
                randGraph.addEdge(e22, v14, v19);
                randGraph.addEdge(e23, v15, v19);
                randGraph.addEdge(e24, v16, v19);               
                randGraph.addEdge(e25, v17, v19);               
                randGraph.addEdge(e26, v18, v19);                               
        
                ctpGraph.rollGraph(randGraph);
                ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
                ctpGraph.populateDGapMap();
				}

        private void initExperimentE2() {
                Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
                
                Vertex v1  = new Vertex("v1");
                Vertex v2  = new Vertex("v2");
                Vertex v3  = new Vertex("v3");
                Vertex v4  = new Vertex("v4");
                Vertex v5  = new Vertex("v5");
                Vertex v6  = new Vertex("v6");
                Vertex v7  = new Vertex("v7");
                Vertex v8  = new Vertex("v8");
                Vertex v9  = new Vertex("v9");
                Vertex v10 = new Vertex("v10");
                Vertex v11 = new Vertex("v11");
                Vertex v12 = new Vertex("v12");
                Vertex v13 = new Vertex("v13");
                Vertex v14 = new Vertex("v14");
                Vertex v15 = new Vertex("v15");
        
                Vertex v16 = new Vertex("v16");
                Vertex v17 = new Vertex("v17");
                Vertex v18 = new Vertex("v18",true);
                Vertex v19 = new Vertex("v19");
                
                //this.explorationVertices.add(v1);
                
                ctpGraph.start = v1;
                ctpGraph.goal  = v19;
                        
                double costMin = 0.0;
                double costMax = 20000.0;
        
                double[] open   = {0.0};
                double[] noCost = open;
                double[] maxCost = {costMax};
                
                Range<Double> costRange = Range.between(costMin, costMax);
                
                double probMid = 0.5;
                double probDev = 0.4;
                Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
                Range<Double> probRange2 = Range.between(0.6, 0.95);
        
                double[] defaultcost   = {100.0 * costMax};
                
                EdgeRandom e1  = new EdgeRandom(Range.between(5.0, 35.0), open, "e1");
                EdgeRandom e2  = new EdgeRandom(Range.between(5.0, 35.0), open, "e2");
                EdgeRandom e3  = new EdgeRandom(Range.between(5.0, 35.0), open, "e3");            
                EdgeRandom e4  = new EdgeRandom(Range.between(5.0, 35.0), open, "e4");
                
                EdgeRandom e5   = new EdgeRandom(new double[] {40.0}, new double[] {0.8}, "e5");
                EdgeRandom e6   = new EdgeRandom(new double[] {40.0}, new double[] {0.8}, "e6");
                EdgeRandom e7   = new EdgeRandom(new double[] {40.0}, new double[] {0.8}, "e7");
                EdgeRandom e8   = new EdgeRandom(new double[] {40.0}, new double[] {0.8}, "e8");
                
                EdgeRandom e9   = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e9");
                EdgeRandom e10  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e10");
                EdgeRandom e11  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e11");
                EdgeRandom e12  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e12");
                EdgeRandom e13  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e13");
                EdgeRandom e14  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e14");
                EdgeRandom e15  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e15");
                EdgeRandom e16  = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e16");
                EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
                
                EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
                EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
                EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
                EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
                EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
                EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
                EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
                EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
                EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
                
                randGraph.addEdge(e1, v1, v2);
                randGraph.addEdge(e2, v1, v3);
                randGraph.addEdge(e3, v1, v4);
                randGraph.addEdge(e4, v1, v5);
                
                randGraph.addEdge(e5, v2, v6);
                randGraph.addEdge(e6, v3, v7);
                randGraph.addEdge(e7, v4, v8);
                randGraph.addEdge(e8, v5, v9);
                
                randGraph.addEdge(e9,  v6, v10);
                randGraph.addEdge(e10, v6, v11);
                randGraph.addEdge(e11, v7, v12);
                randGraph.addEdge(e12, v7, v13);
                randGraph.addEdge(e13, v8, v14);
                randGraph.addEdge(e14, v8, v15);                
                randGraph.addEdge(e15, v9, v16);                
                randGraph.addEdge(e16, v9, v17);
                
                randGraph.addEdge(e17, v1, v18);
                
                randGraph.addEdge(e18, v10, v19);               
                randGraph.addEdge(e19, v11, v19);               
                randGraph.addEdge(e20, v12, v19);
                randGraph.addEdge(e21, v13, v19);
                randGraph.addEdge(e22, v14, v19);
                randGraph.addEdge(e23, v15, v19);
                randGraph.addEdge(e24, v16, v19);               
                randGraph.addEdge(e25, v17, v19);               
                randGraph.addEdge(e26, v18, v19);                               
        
                ctpGraph.rollGraph(randGraph);
                ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
                ctpGraph.populateDGapMap();
				}

        private void initExperimentF1() {
            Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
            
            Vertex v1  = new Vertex("v1");
            Vertex v2  = new Vertex("v2");
            Vertex v3  = new Vertex("v3");
            Vertex v4  = new Vertex("v4");
            Vertex v5  = new Vertex("v5");
            Vertex v6  = new Vertex("v6");
            Vertex v7  = new Vertex("v7");
            Vertex v8  = new Vertex("v8");
            Vertex v9  = new Vertex("v9");
            Vertex v10 = new Vertex("v10");
            Vertex v11 = new Vertex("v11");
            Vertex v12 = new Vertex("v12");
            Vertex v13 = new Vertex("v13");
            Vertex v14 = new Vertex("v14");
            Vertex v15 = new Vertex("v15");
    
            Vertex v16 = new Vertex("v16");
            Vertex v17 = new Vertex("v17");
            Vertex v18 = new Vertex("v18",true);
            Vertex v19 = new Vertex("v19");
            
            //this.explorationVertices.add(v1);
            
            ctpGraph.start = v1;
            ctpGraph.goal  = v19;
                    
            double costMin = 0.0;
            double costMax = 20000.0;
    
            double[] open   = {0.0};
            double[] noCost = open;
            double[] maxCost = {costMax};
            
            Range<Double> costRange = Range.between(costMin, costMax);
            
            double probMid = 0.5;
            double probDev = 0.4;
            Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
            Range<Double> probRange2 = Range.between(0.6, 0.95);
    
            double[] defaultcost   = {100.0 * costMax};
            
            EdgeRandom e1  = new EdgeRandom(Range.between(0.0,    10.0), open, "e1");
            EdgeRandom e2  = new EdgeRandom(Range.between(0.0,    10.0), open, "e2");
            EdgeRandom e3  = new EdgeRandom(Range.between(0.0,    10.0), open, "e3");            
            EdgeRandom e4  = new EdgeRandom(Range.between(0.0,    10.0), open, "e4");
            
            EdgeRandom e5   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.65, 0.95), "e5");
            EdgeRandom e6   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.65, 0.95), "e6");
            EdgeRandom e7   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.65, 0.95), "e7");
            EdgeRandom e8   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.65, 0.95), "e8");
            
            EdgeRandom e9   = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e9");
            EdgeRandom e10  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e10");
            EdgeRandom e11  = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e11");
            EdgeRandom e12  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e12");
            EdgeRandom e13  = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e13");
            EdgeRandom e14  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e14");
            EdgeRandom e15  = new EdgeRandom(Range.between(50.0,   150.0), Range.between(0.4, 0.8), "e15");
            EdgeRandom e16  = new EdgeRandom(Range.between( 50.0,   150.0), Range.between(0.4, 0.8), "e16");
            EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
            
            EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
            EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
            EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
            EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
            EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
            EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
            EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
            EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
            EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
            
            randGraph.addEdge(e1, v1, v2);
            randGraph.addEdge(e2, v1, v3);
            randGraph.addEdge(e3, v1, v4);
            randGraph.addEdge(e4, v1, v5);
            
            randGraph.addEdge(e5, v2, v6);
            randGraph.addEdge(e6, v3, v7);
            randGraph.addEdge(e7, v4, v8);
            randGraph.addEdge(e8, v5, v9);
            
            randGraph.addEdge(e9,  v6, v10);
            randGraph.addEdge(e10, v6, v11);
            randGraph.addEdge(e11, v7, v12);
            randGraph.addEdge(e12, v7, v13);
            randGraph.addEdge(e13, v8, v14);
            randGraph.addEdge(e14, v8, v15);                
            randGraph.addEdge(e15, v9, v16);                
            randGraph.addEdge(e16, v9, v17);
            
            randGraph.addEdge(e17, v1, v18);
            
            randGraph.addEdge(e18, v10, v19);               
            randGraph.addEdge(e19, v11, v19);               
            randGraph.addEdge(e20, v12, v19);
            randGraph.addEdge(e21, v13, v19);
            randGraph.addEdge(e22, v14, v19);
            randGraph.addEdge(e23, v15, v19);
            randGraph.addEdge(e24, v16, v19);               
            randGraph.addEdge(e25, v17, v19);               
            randGraph.addEdge(e26, v18, v19);                               
    
            ctpGraph.rollGraph(randGraph);
            ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
            ctpGraph.populateDGapMap();
			}
        
        private void initExperimentF2() {
                Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
                
                Vertex v1  = new Vertex("v1");
                Vertex v2  = new Vertex("v2");
                Vertex v3  = new Vertex("v3");
                Vertex v4  = new Vertex("v4");
                Vertex v5  = new Vertex("v5");
                Vertex v6  = new Vertex("v6");
                Vertex v7  = new Vertex("v7");
                Vertex v8  = new Vertex("v8");
                Vertex v9  = new Vertex("v9");
                Vertex v10 = new Vertex("v10");
                Vertex v11 = new Vertex("v11");
                Vertex v12 = new Vertex("v12");
                Vertex v13 = new Vertex("v13");
                Vertex v14 = new Vertex("v14");
                Vertex v15 = new Vertex("v15");
        
                Vertex v16 = new Vertex("v16");
                Vertex v17 = new Vertex("v17");
                Vertex v18 = new Vertex("v18",true);
                Vertex v19 = new Vertex("v19");
                
                //this.explorationVertices.add(v1);
                
                ctpGraph.start = v1;
                ctpGraph.goal  = v19;
                        
                double costMin = 0.0;
                double costMax = 20000.0;
        
                double[] open   = {0.0};
                double[] noCost = open;
                double[] maxCost = {costMax};
                
                Range<Double> costRange = Range.between(costMin, costMax);
                
                double probMid = 0.5;
                double probDev = 0.4;
                Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
                Range<Double> probRange2 = Range.between(0.6, 0.95);
        
                double[] defaultcost   = {100.0 * costMax};
                
                EdgeRandom e1  = new EdgeRandom(Range.between(0.0, 10.0), open, "e1");
                EdgeRandom e2  = new EdgeRandom(Range.between(0.0, 10.0), open, "e2");
                EdgeRandom e3  = new EdgeRandom(Range.between(0.0, 10.0), open, "e3");            
                EdgeRandom e4  = new EdgeRandom(Range.between(0.0, 10.0), open, "e4");
                
                EdgeRandom e5   = new EdgeRandom(new double[]{5.0}, new double[]{0.8}, "e5");
                EdgeRandom e6   = new EdgeRandom(new double[]{5.0}, new double[]{0.8}, "e6");
                EdgeRandom e7   = new EdgeRandom(new double[]{5.0}, new double[]{0.8}, "e7");
                EdgeRandom e8   = new EdgeRandom(new double[]{5.0}, new double[]{0.8}, "e8");
                
                EdgeRandom e9   = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e9");
                EdgeRandom e10  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e10");
                EdgeRandom e11  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e11");
                EdgeRandom e12  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e12");
                EdgeRandom e13  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e13");
                EdgeRandom e14  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e14");
                EdgeRandom e15  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e15");
                EdgeRandom e16  = new EdgeRandom(new double[]{100.0}, new double[]{0.6}, "e16");
                EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
                
                EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
                EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
                EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
                EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
                EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
                EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
                EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
                EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
                EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
                
                randGraph.addEdge(e1, v1, v2);
                randGraph.addEdge(e2, v1, v3);
                randGraph.addEdge(e3, v1, v4);
                randGraph.addEdge(e4, v1, v5);
                
                randGraph.addEdge(e5, v2, v6);
                randGraph.addEdge(e6, v3, v7);
                randGraph.addEdge(e7, v4, v8);
                randGraph.addEdge(e8, v5, v9);
                
                randGraph.addEdge(e9,  v6, v10);
                randGraph.addEdge(e10, v6, v11);
                randGraph.addEdge(e11, v7, v12);
                randGraph.addEdge(e12, v7, v13);
                randGraph.addEdge(e13, v8, v14);
                randGraph.addEdge(e14, v8, v15);                
                randGraph.addEdge(e15, v9, v16);                
                randGraph.addEdge(e16, v9, v17);
                
                randGraph.addEdge(e17, v1, v18);
                
                randGraph.addEdge(e18, v10, v19);               
                randGraph.addEdge(e19, v11, v19);               
                randGraph.addEdge(e20, v12, v19);
                randGraph.addEdge(e21, v13, v19);
                randGraph.addEdge(e22, v14, v19);
                randGraph.addEdge(e23, v15, v19);
                randGraph.addEdge(e24, v16, v19);               
                randGraph.addEdge(e25, v17, v19);               
                randGraph.addEdge(e26, v18, v19);                               
        
                ctpGraph.rollGraph(randGraph);
                ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
                ctpGraph.populateDGapMap();
				}

        
        
        
        

	private void initExperimentG1() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();

		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		Vertex v8 = new Vertex("v8");
		Vertex v9 = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");

		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18", true);
		Vertex v19 = new Vertex("v19");

		// this.explorationVertices.add(v1);

		ctpGraph.start = v1;
		ctpGraph.goal = v19;

		double costMin = 0.0;
		double costMax = 20000.0;

		double[] open = { 0.0 };
		double[] noCost = open;
		double[] maxCost = { costMax };

		Range<Double> costRange = Range.between(costMin, costMax);

		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid
				+ probDev);
		Range<Double> probRange2 = Range.between(0.6, 0.95);

		double[] defaultcost = { 100.0 * costMax };

		EdgeRandom e1 = new EdgeRandom(Range.between(5.0, 35.0), open, "e1");
		EdgeRandom e2 = new EdgeRandom(Range.between(21.715609, 51.715609),
				open, "e2");
		EdgeRandom e3 = new EdgeRandom(Range.between(13.043364, 33.043364),
				open, "e3");
		EdgeRandom e4 = new EdgeRandom(Range.between(4.226006, 34.226006),
				open, "e4");

		EdgeRandom e5 = new EdgeRandom(Range.between(20.0, 60.0),
				Range.between(0.35, 0.65), "e5");
		EdgeRandom e6 = new EdgeRandom(Range.between(29.233610, 69.233610),
				Range.between(0.15, 0.45), "e6");
		EdgeRandom e7 = new EdgeRandom(Range.between(4.754991, 44.754991),
				Range.between(0.05, 0.15), "e7");
		EdgeRandom e8 = new EdgeRandom(Range.between(35.594542, 55.594542),
				Range.between(0.45, 0.75), "e8");

		EdgeRandom e9 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.45, 0.75), "e9");
		EdgeRandom e10 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.25, 0.55), "e10");
		EdgeRandom e11 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.55, 0.85), "e11");
		EdgeRandom e12 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.05, 0.35), "e12");
		EdgeRandom e13 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.8, 1.0), "e13");
		EdgeRandom e14 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.35, 0.65), "e14");
		EdgeRandom e15 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.05, 0.35), "e15");
		EdgeRandom e16 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.25, 0.55), "e16");
		EdgeRandom e17 = new EdgeRandom(maxCost, open, "e17");

		EdgeRandom e18 = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19 = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20 = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21 = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22 = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23 = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24 = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25 = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26 = new EdgeRandom(noCost, open, "e26");

		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);

		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);

		randGraph.addEdge(e9, v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);
		randGraph.addEdge(e15, v9, v16);
		randGraph.addEdge(e16, v9, v17);

		randGraph.addEdge(e17, v1, v18);

		randGraph.addEdge(e18, v10, v19);
		randGraph.addEdge(e19, v11, v19);
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);
		randGraph.addEdge(e25, v17, v19);
		randGraph.addEdge(e26, v18, v19);

		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}        
	
    
    
    
    

	private void initExperimentG2() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();

		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		Vertex v8 = new Vertex("v8");
		Vertex v9 = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");

		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18", true);
		Vertex v19 = new Vertex("v19");

		// this.explorationVertices.add(v1);

		ctpGraph.start = v1;
		ctpGraph.goal = v19;

		double costMin = 0.0;
		double costMax = 20000.0;

		double[] open = { 0.0 };
		double[] noCost = open;
		double[] maxCost = { costMax };

		Range<Double> costRange = Range.between(costMin, costMax);

		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid
				+ probDev);
		Range<Double> probRange2 = Range.between(0.6, 0.95);

		double[] defaultcost = { 100.0 * costMax };

		EdgeRandom e1 = new EdgeRandom(Range.between(5.0, 35.0), open, "e1");
		EdgeRandom e2 = new EdgeRandom(Range.between(21.715609, 51.715609),
				open, "e2");
		EdgeRandom e3 = new EdgeRandom(Range.between(13.043364, 33.043364),
				open, "e3");
		EdgeRandom e4 = new EdgeRandom(Range.between(4.226006, 34.226006),
				open, "e4");

		EdgeRandom e5 = new EdgeRandom(new double[] { 40 },new double[] { 0.5 }, "e5");
		EdgeRandom e6 = new EdgeRandom(new double[] { 49.233610 },new double[] { 0.3 }, "e6");
		EdgeRandom e7 = new EdgeRandom(new double[] { 24.754991 },
				new double[] { 0.1 }, "e7");
		EdgeRandom e8 = new EdgeRandom(new double[] { 55.594542 },
				new double[] { 0.6 }, "e8");

		EdgeRandom e9 = new EdgeRandom(new double[] { 100.0 },  new double[] { 0.6 }, "e9");
		EdgeRandom e10 = new EdgeRandom(new double[] { 100.0 }, new double[] { 0.4 }, "e10");
		EdgeRandom e11 = new EdgeRandom(new double[] { 100.0 }, new double[] { 0.7 }, "e11");
		EdgeRandom e12 = new EdgeRandom(new double[] { 100.0 }, new double[] { 0.2 }, "e12");
		EdgeRandom e13 = new EdgeRandom(new double[] { 0.0 },   new double[] { 0.9 }, "e13");
		EdgeRandom e14 = new EdgeRandom(new double[] { 100.0 }, new double[] { 0.5 }, "e14");
		EdgeRandom e15 = new EdgeRandom(new double[] { 100.0 },
				new double[] { 0.2 }, "e15");
		EdgeRandom e16 = new EdgeRandom(new double[] { 100.0 },
				new double[] { 0.4 }, "e16");
		EdgeRandom e17 = new EdgeRandom(maxCost, open, "e17");

		EdgeRandom e18 = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19 = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20 = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21 = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22 = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23 = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24 = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25 = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26 = new EdgeRandom(noCost, open, "e26");

		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);

		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);

		randGraph.addEdge(e9, v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);
		randGraph.addEdge(e15, v9, v16);
		randGraph.addEdge(e16, v9, v17);

		randGraph.addEdge(e17, v1, v18);

		randGraph.addEdge(e18, v10, v19);
		randGraph.addEdge(e19, v11, v19);
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);
		randGraph.addEdge(e25, v17, v19);
		randGraph.addEdge(e26, v18, v19);

		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}
	
	private void initExperimentH1() {
		Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();

		Vertex v1 = new Vertex("v1");
		Vertex v2 = new Vertex("v2");
		Vertex v3 = new Vertex("v3");
		Vertex v4 = new Vertex("v4");
		Vertex v5 = new Vertex("v5");
		Vertex v6 = new Vertex("v6");
		Vertex v7 = new Vertex("v7");
		Vertex v8 = new Vertex("v8");
		Vertex v9 = new Vertex("v9");
		Vertex v10 = new Vertex("v10");
		Vertex v11 = new Vertex("v11");
		Vertex v12 = new Vertex("v12");
		Vertex v13 = new Vertex("v13");
		Vertex v14 = new Vertex("v14");
		Vertex v15 = new Vertex("v15");

		Vertex v16 = new Vertex("v16");
		Vertex v17 = new Vertex("v17");
		Vertex v18 = new Vertex("v18", true);
		Vertex v19 = new Vertex("v19");

		// this.explorationVertices.add(v1);

		ctpGraph.start = v1;
		ctpGraph.goal = v19;

		double costMin = 0.0;
		double costMax = 20000.0;

		double[] open = { 0.0 };
		double[] noCost = open;
		double[] maxCost = { costMax };

		Range<Double> costRange = Range.between(costMin, costMax);

		double probMid = 0.5;
		double probDev = 0.4;
		Range<Double> probRange = Range.between(probMid - probDev, probMid
				+ probDev);
		Range<Double> probRange2 = Range.between(0.6, 0.95);

		double[] defaultcost = { 100.0 * costMax };

		EdgeRandom e1 = new EdgeRandom(Range.between(1.0, 9.0), open, "e1");
		EdgeRandom e2 = new EdgeRandom(Range.between(4.178902, 14.178902),
				open, "e2");
		EdgeRandom e3 = new EdgeRandom(Range.between(2.010841, 12.010841),
				open, "e3");
		EdgeRandom e4 = new EdgeRandom(Range.between(1.806501, 7.806501), open,
				"e4");

		EdgeRandom e5 = new EdgeRandom(Range.between(1.0, 9.0), Range.between(
				0.35, 0.65), "e5");
		EdgeRandom e6 = new EdgeRandom(Range.between(1.154201, 11.154201),
				Range.between(0.15, 0.45), "e6");
		EdgeRandom e7 = new EdgeRandom(Range.between(0.094374, 6.094374),
				Range.between(0.05, 0.15), "e7");
		EdgeRandom e8 = new EdgeRandom(Range.between(1.949318, 11.949318),
				Range.between(0.45, 0.75), "e8");

		EdgeRandom e9 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.45, 0.75), "e9");
		EdgeRandom e10 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.25, 0.55), "e10");
		EdgeRandom e11 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.55, 0.85), "e11");
		EdgeRandom e12 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.05, 0.35), "e12");
		EdgeRandom e13 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.8, 1.0), "e13");
		EdgeRandom e14 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.35, 0.65), "e14");
		EdgeRandom e15 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.05, 0.35), "e15");
		EdgeRandom e16 = new EdgeRandom(Range.between(50.0, 150.0),
				Range.between(0.25, 0.55), "e16");
		EdgeRandom e17 = new EdgeRandom(maxCost, open, "e17");

		EdgeRandom e18 = new EdgeRandom(noCost, open, "e18");
		EdgeRandom e19 = new EdgeRandom(noCost, open, "e19");
		EdgeRandom e20 = new EdgeRandom(noCost, open, "e20");
		EdgeRandom e21 = new EdgeRandom(noCost, open, "e21");
		EdgeRandom e22 = new EdgeRandom(noCost, open, "e22");
		EdgeRandom e23 = new EdgeRandom(noCost, open, "e23");
		EdgeRandom e24 = new EdgeRandom(noCost, open, "e24");
		EdgeRandom e25 = new EdgeRandom(noCost, open, "e25");
		EdgeRandom e26 = new EdgeRandom(noCost, open, "e26");

		randGraph.addEdge(e1, v1, v2);
		randGraph.addEdge(e2, v1, v3);
		randGraph.addEdge(e3, v1, v4);
		randGraph.addEdge(e4, v1, v5);

		randGraph.addEdge(e5, v2, v6);
		randGraph.addEdge(e6, v3, v7);
		randGraph.addEdge(e7, v4, v8);
		randGraph.addEdge(e8, v5, v9);

		randGraph.addEdge(e9, v6, v10);
		randGraph.addEdge(e10, v6, v11);
		randGraph.addEdge(e11, v7, v12);
		randGraph.addEdge(e12, v7, v13);
		randGraph.addEdge(e13, v8, v14);
		randGraph.addEdge(e14, v8, v15);
		randGraph.addEdge(e15, v9, v16);
		randGraph.addEdge(e16, v9, v17);

		randGraph.addEdge(e17, v1, v18);

		randGraph.addEdge(e18, v10, v19);
		randGraph.addEdge(e19, v11, v19);
		randGraph.addEdge(e20, v12, v19);
		randGraph.addEdge(e21, v13, v19);
		randGraph.addEdge(e22, v14, v19);
		randGraph.addEdge(e23, v15, v19);
		randGraph.addEdge(e24, v16, v19);
		randGraph.addEdge(e25, v17, v19);
		randGraph.addEdge(e26, v18, v19);

		ctpGraph.rollGraph(randGraph);
		ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
		ctpGraph.populateDGapMap();
	}	
	
    private void initExperimentH2() {
        Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
        
        Vertex v1  = new Vertex("v1");
        Vertex v2  = new Vertex("v2");
        Vertex v3  = new Vertex("v3");
        Vertex v4  = new Vertex("v4");
        Vertex v5  = new Vertex("v5");
        Vertex v6  = new Vertex("v6");
        Vertex v7  = new Vertex("v7");
        Vertex v8  = new Vertex("v8");
        Vertex v9  = new Vertex("v9");
        Vertex v10 = new Vertex("v10");
        Vertex v11 = new Vertex("v11");
        Vertex v12 = new Vertex("v12");
        Vertex v13 = new Vertex("v13");
        Vertex v14 = new Vertex("v14");
        Vertex v15 = new Vertex("v15");

        Vertex v16 = new Vertex("v16");
        Vertex v17 = new Vertex("v17");
        Vertex v18 = new Vertex("v18",true);
        Vertex v19 = new Vertex("v19");
        
        //this.explorationVertices.add(v1);
        
        ctpGraph.start = v1;
        ctpGraph.goal  = v19;
                
        double costMin = 0.0;
        double costMax = 20000.0;

        double[] open   = {0.0};
        double[] noCost = open;
        double[] maxCost = {costMax};
        
        Range<Double> costRange = Range.between(costMin, costMax);
        
        double probMid = 0.5;
        double probDev = 0.4;
        Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
        Range<Double> probRange2 = Range.between(0.6, 0.95);

        double[] defaultcost   = {100.0 * costMax};
        
        EdgeRandom e1  = new EdgeRandom(Range.between(1.0,9.0), open, "e1");
        EdgeRandom e2  = new EdgeRandom(Range.between(4.178902, 14.178902), open, "e2");
        EdgeRandom e3  = new EdgeRandom(Range.between(2.010841,    12.010841), open, "e3");            
        EdgeRandom e4  = new EdgeRandom(Range.between(1.806501,    7.806501), open, "e4");
        
        EdgeRandom e5   = new EdgeRandom(new double[] {5}, new double[] {0.5}, "e5");
        EdgeRandom e6   = new EdgeRandom(new double[] {6.154201}, new double[] {0.3}, "e6");
        EdgeRandom e7   = new EdgeRandom(new double[] {3.094374}, new double[] {0.1}, "e7");
        EdgeRandom e8   = new EdgeRandom(new double[] {6.949318}, new double[] {0.6}, "e8");
        
        EdgeRandom e9   = new EdgeRandom(new double[] {100.0}, new double[] {0.6}, "e9");        
        EdgeRandom e10 =  new EdgeRandom(new double[] { 100.0 }, new double[] { 0.4 }, "e10");
        EdgeRandom e11  = new EdgeRandom(new double[] {100.0}, new double[] {0.7}, "e11");
        EdgeRandom e12  = new EdgeRandom(new double[] {100.0}, new double[] {0.2}, "e12");
        EdgeRandom e13  = new EdgeRandom(new double[] {100.0}, new double[] {0.9}, "e13");
        EdgeRandom e14  = new EdgeRandom(new double[] {100.0}, new double[] {0.5}, "e14");
        EdgeRandom e15  = new EdgeRandom(new double[] {100.0}, new double[] {0.2}, "e15");
        EdgeRandom e16  = new EdgeRandom(new double[] {100.0}, new double[] {0.4}, "e16");
        EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
        
        EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
        EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
        EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
        EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
        EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
        EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
        EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
        EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
        EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
        
        randGraph.addEdge(e1, v1, v2);
        randGraph.addEdge(e2, v1, v3);
        randGraph.addEdge(e3, v1, v4);
        randGraph.addEdge(e4, v1, v5);
        
        randGraph.addEdge(e5, v2, v6);
        randGraph.addEdge(e6, v3, v7);
        randGraph.addEdge(e7, v4, v8);
        randGraph.addEdge(e8, v5, v9);
        
        randGraph.addEdge(e9,  v6, v10);
        randGraph.addEdge(e10, v6, v11);
        randGraph.addEdge(e11, v7, v12);
        randGraph.addEdge(e12, v7, v13);
        randGraph.addEdge(e13, v8, v14);
        randGraph.addEdge(e14, v8, v15);                
        randGraph.addEdge(e15, v9, v16);                
        randGraph.addEdge(e16, v9, v17);
        
        randGraph.addEdge(e17, v1, v18);
        
        randGraph.addEdge(e18, v10, v19);               
        randGraph.addEdge(e19, v11, v19);               
        randGraph.addEdge(e20, v12, v19);
        randGraph.addEdge(e21, v13, v19);
        randGraph.addEdge(e22, v14, v19);
        randGraph.addEdge(e23, v15, v19);
        randGraph.addEdge(e24, v16, v19);               
        randGraph.addEdge(e25, v17, v19);               
        randGraph.addEdge(e26, v18, v19);                               

        ctpGraph.rollGraph(randGraph);
        ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
        ctpGraph.populateDGapMap();
		}	
	
    private void initExperimentI1() {
        Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
        
        Vertex v1  = new Vertex("v1");
        Vertex v2  = new Vertex("v2");
        Vertex v3  = new Vertex("v3");
        Vertex v4  = new Vertex("v4");
        Vertex v5  = new Vertex("v5");
        Vertex v6  = new Vertex("v6");
        Vertex v7  = new Vertex("v7");
        Vertex v8  = new Vertex("v8");
        Vertex v9  = new Vertex("v9");
        Vertex v10 = new Vertex("v10");
        Vertex v11 = new Vertex("v11");
        Vertex v12 = new Vertex("v12");
        Vertex v13 = new Vertex("v13");
        Vertex v14 = new Vertex("v14");
        Vertex v15 = new Vertex("v15");

        Vertex v16 = new Vertex("v16");
        Vertex v17 = new Vertex("v17");
        Vertex v18 = new Vertex("v18",true);
        Vertex v19 = new Vertex("v19");
        
        //this.explorationVertices.add(v1);
        
        ctpGraph.start = v1;
        ctpGraph.goal  = v19;
                
        double costMin = 0.0;
        double costMax = 20000.0;

        double[] open   = {0.0};
        double[] noCost = open;
        double[] maxCost = {costMax};
        
        Range<Double> costRange = Range.between(costMin, costMax);
        
        double probMid = 0.5;
        double probDev = 0.4;
        Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
        Range<Double> probRange2 = Range.between(0.6, 0.95);

        double[] defaultcost   = {100.0 * costMax};
        
        EdgeRandom e1  = new EdgeRandom(Range.between(0.0,    10.0), open, "e1");
        EdgeRandom e2  = new EdgeRandom(Range.between(0.0,    10.0), open, "e2");
        EdgeRandom e3  = new EdgeRandom(Range.between(0.0,    10.0), open, "e3");            
        EdgeRandom e4  = new EdgeRandom(Range.between(0.0,    10.0), open, "e4");
        
        EdgeRandom e5   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e5");
        EdgeRandom e6   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e6");
        EdgeRandom e7   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e7");
        EdgeRandom e8   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e8");
        
        EdgeRandom e9   = new EdgeRandom(Range.between(   0.0,   500.0), Range.between(0.2, 0.8), "e9");
        EdgeRandom e10  = new EdgeRandom(Range.between( 500.0,  1000.0), Range.between(0.4, 0.8), "e10");
        EdgeRandom e11  = new EdgeRandom(Range.between(   0.0,   500.0), Range.between(0.2, 0.8), "e11");
        EdgeRandom e12  = new EdgeRandom(Range.between( 500.0,  1000.0), Range.between(0.4, 0.8), "e12");
        EdgeRandom e13  = new EdgeRandom(Range.between(   0.0,   500.0), Range.between(0.2, 0.8), "e13");
        EdgeRandom e14  = new EdgeRandom(Range.between( 500.0,  1000.0), Range.between(0.4, 0.8), "e14");
        EdgeRandom e15  = new EdgeRandom(Range.between(   0.0,   500.0), Range.between(0.2, 0.8), "e15");
        EdgeRandom e16  = new EdgeRandom(Range.between( 500.0,  1000.0), Range.between(0.4, 0.8), "e16");
        EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
        
        EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
        EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
        EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
        EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
        EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
        EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
        EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
        EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
        EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
        
        randGraph.addEdge(e1, v1, v2);
        randGraph.addEdge(e2, v1, v3);
        randGraph.addEdge(e3, v1, v4);
        randGraph.addEdge(e4, v1, v5);
        
        randGraph.addEdge(e5, v2, v6);
        randGraph.addEdge(e6, v3, v7);
        randGraph.addEdge(e7, v4, v8);
        randGraph.addEdge(e8, v5, v9);
        
        randGraph.addEdge(e9,  v6, v10);
        randGraph.addEdge(e10, v6, v11);
        randGraph.addEdge(e11, v7, v12);
        randGraph.addEdge(e12, v7, v13);
        randGraph.addEdge(e13, v8, v14);
        randGraph.addEdge(e14, v8, v15);                
        randGraph.addEdge(e15, v9, v16);                
        randGraph.addEdge(e16, v9, v17);
        
        randGraph.addEdge(e17, v1, v18);
        
        randGraph.addEdge(e18, v10, v19);               
        randGraph.addEdge(e19, v11, v19);               
        randGraph.addEdge(e20, v12, v19);
        randGraph.addEdge(e21, v13, v19);
        randGraph.addEdge(e22, v14, v19);
        randGraph.addEdge(e23, v15, v19);
        randGraph.addEdge(e24, v16, v19);               
        randGraph.addEdge(e25, v17, v19);               
        randGraph.addEdge(e26, v18, v19);                               

        ctpGraph.rollGraph(randGraph);
        ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
        ctpGraph.populateDGapMap();
		}

    

    private void initExperimentI2() {
            Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
            
            Vertex v1  = new Vertex("v1");
            Vertex v2  = new Vertex("v2");
            Vertex v3  = new Vertex("v3");
            Vertex v4  = new Vertex("v4");
            Vertex v5  = new Vertex("v5");
            Vertex v6  = new Vertex("v6");
            Vertex v7  = new Vertex("v7");
            Vertex v8  = new Vertex("v8");
            Vertex v9  = new Vertex("v9");
            Vertex v10 = new Vertex("v10");
            Vertex v11 = new Vertex("v11");
            Vertex v12 = new Vertex("v12");
            Vertex v13 = new Vertex("v13");
            Vertex v14 = new Vertex("v14");
            Vertex v15 = new Vertex("v15");
    
            Vertex v16 = new Vertex("v16");
            Vertex v17 = new Vertex("v17");
            Vertex v18 = new Vertex("v18",true);
            Vertex v19 = new Vertex("v19");
            
            //this.explorationVertices.add(v1);
            
            ctpGraph.start = v1;
            ctpGraph.goal  = v19;
                    
            double costMin = 0.0;
            double costMax = 20000.0;
    
            double[] open   = {0.0};
            double[] noCost = open;
            double[] maxCost = {costMax};
            
            Range<Double> costRange = Range.between(costMin, costMax);
            
            double probMid = 0.5;
            double probDev = 0.4;
            Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
            Range<Double> probRange2 = Range.between(0.6, 0.95);
    
            double[] defaultcost   = {100.0 * costMax};
            
            EdgeRandom e1  = new EdgeRandom(Range.between(0.0,    10.0), open, "e1");
            EdgeRandom e2  = new EdgeRandom(Range.between(0.0,    10.0), open, "e2");
            EdgeRandom e3  = new EdgeRandom(Range.between(0.0,    10.0), open, "e3");            
            EdgeRandom e4  = new EdgeRandom(Range.between(0.0,    10.0), open, "e4");
            
            EdgeRandom e5   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e5");
            EdgeRandom e6   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e6");
            EdgeRandom e7   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e7");
            EdgeRandom e8   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e8");
            
            EdgeRandom e9   = new EdgeRandom(Range.between(    0.0,   500.0), Range.between(0.2, 0.8), "e9");
            EdgeRandom e10  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e10");
            EdgeRandom e11  = new EdgeRandom(Range.between(    0.0,   500.0), Range.between(0.2, 0.8), "e11");
            EdgeRandom e12  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e12");
            EdgeRandom e13  = new EdgeRandom(Range.between(    0.0,   500.0), Range.between(0.2, 0.8), "e13");
            EdgeRandom e14  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e14");
            EdgeRandom e15  = new EdgeRandom(Range.between(    0.0,   500.0), Range.between(0.2, 0.8), "e15");
            EdgeRandom e16  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e16");
            EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
            
            EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
            EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
            EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
            EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
            EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
            EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
            EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
            EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
            EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
            
            randGraph.addEdge(e1, v1, v2);
            randGraph.addEdge(e2, v1, v3);
            randGraph.addEdge(e3, v1, v4);
            randGraph.addEdge(e4, v1, v5);
            
            randGraph.addEdge(e5, v2, v6);
            randGraph.addEdge(e6, v3, v7);
            randGraph.addEdge(e7, v4, v8);
            randGraph.addEdge(e8, v5, v9);
            
            randGraph.addEdge(e9,  v6, v10);
            randGraph.addEdge(e10, v6, v11);
            randGraph.addEdge(e11, v7, v12);
            randGraph.addEdge(e12, v7, v13);
            randGraph.addEdge(e13, v8, v14);
            randGraph.addEdge(e14, v8, v15);                
            randGraph.addEdge(e15, v9, v16);                
            randGraph.addEdge(e16, v9, v17);
            
            randGraph.addEdge(e17, v1, v18);
            
            randGraph.addEdge(e18, v10, v19);               
            randGraph.addEdge(e19, v11, v19);               
            randGraph.addEdge(e20, v12, v19);
            randGraph.addEdge(e21, v13, v19);
            randGraph.addEdge(e22, v14, v19);
            randGraph.addEdge(e23, v15, v19);
            randGraph.addEdge(e24, v16, v19);               
            randGraph.addEdge(e25, v17, v19);               
            randGraph.addEdge(e26, v18, v19);                               
    
            ctpGraph.rollGraph(randGraph);
            ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
            ctpGraph.populateDGapMap();
			}

    
    

    private void initExperimentI3() {
            Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
            
            Vertex v1  = new Vertex("v1");
            Vertex v2  = new Vertex("v2");
            Vertex v3  = new Vertex("v3");
            Vertex v4  = new Vertex("v4");
            Vertex v5  = new Vertex("v5");
            Vertex v6  = new Vertex("v6");
            Vertex v7  = new Vertex("v7");
            Vertex v8  = new Vertex("v8");
            Vertex v9  = new Vertex("v9");
            Vertex v10 = new Vertex("v10");
            Vertex v11 = new Vertex("v11");
            Vertex v12 = new Vertex("v12");
            Vertex v13 = new Vertex("v13");
            Vertex v14 = new Vertex("v14");
            Vertex v15 = new Vertex("v15");
    
            Vertex v16 = new Vertex("v16");
            Vertex v17 = new Vertex("v17");
            Vertex v18 = new Vertex("v18",true);
            Vertex v19 = new Vertex("v19");
            
            //this.explorationVertices.add(v1);
            
            ctpGraph.start = v1;
            ctpGraph.goal  = v19;
                    
            double costMin = 0.0;
            double costMax = 20000.0;
    
            double[] open   = {0.0};
            double[] noCost = open;
            double[] maxCost = {costMax};
            
            Range<Double> costRange = Range.between(costMin, costMax);
            
            double probMid = 0.5;
            double probDev = 0.4;
            Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
            Range<Double> probRange2 = Range.between(0.6, 0.95);
    
            double[] defaultcost   = {100.0 * costMax};
            
            EdgeRandom e1  = new EdgeRandom(Range.between(0.0,    10.0), open, "e1");
            EdgeRandom e2  = new EdgeRandom(Range.between(0.0,    10.0), open, "e2");
            EdgeRandom e3  = new EdgeRandom(Range.between(0.0,    10.0), open, "e3");            
            EdgeRandom e4  = new EdgeRandom(Range.between(0.0,    10.0), open, "e4");
            
            EdgeRandom e5   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e5");
            EdgeRandom e6   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e6");
            EdgeRandom e7   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e7");
            EdgeRandom e8   = new EdgeRandom(Range.between(0.0,   10.0), Range.between(0.0, 0.2), "e8");
            
            EdgeRandom e9   = new EdgeRandom(Range.between(    0.0,   1500.0), Range.between(0.2, 0.8), "e9");
            EdgeRandom e10  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e10");
            EdgeRandom e11  = new EdgeRandom(Range.between(    0.0,   1500.0), Range.between(0.2, 0.8), "e11");
            EdgeRandom e12  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e12");
            EdgeRandom e13  = new EdgeRandom(Range.between(    0.0,   1500.0), Range.between(0.2, 0.8), "e13");
            EdgeRandom e14  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e14");
            EdgeRandom e15  = new EdgeRandom(Range.between(    0.0,   1500.0), Range.between(0.2, 0.8), "e15");
            EdgeRandom e16  = new EdgeRandom(Range.between( 1000.0,   2000.0), Range.between(0.4, 0.8), "e16");
            EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
            
            EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
            EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
            EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
            EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
            EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
            EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
            EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
            EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
            EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
            
            randGraph.addEdge(e1, v1, v2);
            randGraph.addEdge(e2, v1, v3);
            randGraph.addEdge(e3, v1, v4);
            randGraph.addEdge(e4, v1, v5);
            
            randGraph.addEdge(e5, v2, v6);
            randGraph.addEdge(e6, v3, v7);
            randGraph.addEdge(e7, v4, v8);
            randGraph.addEdge(e8, v5, v9);
            
            randGraph.addEdge(e9,  v6, v10);
            randGraph.addEdge(e10, v6, v11);
            randGraph.addEdge(e11, v7, v12);
            randGraph.addEdge(e12, v7, v13);
            randGraph.addEdge(e13, v8, v14);
            randGraph.addEdge(e14, v8, v15);                
            randGraph.addEdge(e15, v9, v16);                
            randGraph.addEdge(e16, v9, v17);
            
            randGraph.addEdge(e17, v1, v18);
            
            randGraph.addEdge(e18, v10, v19);               
            randGraph.addEdge(e19, v11, v19);               
            randGraph.addEdge(e20, v12, v19);
            randGraph.addEdge(e21, v13, v19);
            randGraph.addEdge(e22, v14, v19);
            randGraph.addEdge(e23, v15, v19);
            randGraph.addEdge(e24, v16, v19);               
            randGraph.addEdge(e25, v17, v19);               
            randGraph.addEdge(e26, v18, v19);                               
    
            ctpGraph.rollGraph(randGraph);
            ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
            ctpGraph.populateDGapMap();
			}

    
    private void initExperimentE2Special() {
	Graph<Vertex, EdgeRandom> randGraph = new SparseGraph<Vertex, EdgeRandom>();
	
	Vertex v1  = new Vertex("v1");
	Vertex v2  = new Vertex("v2");
	Vertex v3  = new Vertex("v3");
	Vertex v4  = new Vertex("v4");
	Vertex v5  = new Vertex("v5");
	Vertex v6  = new Vertex("v6");
	Vertex v7  = new Vertex("v7");
	Vertex v8  = new Vertex("v8");
	Vertex v9  = new Vertex("v9");
	Vertex v10 = new Vertex("v10");
	Vertex v11 = new Vertex("v11");
	Vertex v12 = new Vertex("v12");
	Vertex v13 = new Vertex("v13");
	Vertex v14 = new Vertex("v14");
	Vertex v15 = new Vertex("v15");
	
	Vertex v16 = new Vertex("v16");
	Vertex v17 = new Vertex("v17");
	Vertex v18 = new Vertex("v18",true);
	Vertex v19 = new Vertex("v19");
	
	//this.explorationVertices.add(v1);
	
	ctpGraph.start = v1;
	ctpGraph.goal  = v19;
	        
	double costMin = 0.0;
	double costMax = 20000.0;
	
	double[] open   = {0.0};
	double[] noCost = open;
	double[] maxCost = {costMax};
	
	Range<Double> costRange = Range.between(costMin, costMax);
	
	double probMid = 0.5;
	double probDev = 0.4;
	Range<Double> probRange = Range.between(probMid - probDev, probMid + probDev);
	Range<Double> probRange2 = Range.between(0.6, 0.95);
	
	double[] defaultcost   = {100.0 * costMax};
	
	EdgeRandom e1  = new EdgeRandom(new double[]{1.0}, open, "e1");
	EdgeRandom e2  = new EdgeRandom(new double[]{1.0}, open, "e2");
	EdgeRandom e3  = new EdgeRandom(new double[]{1.0}, open, "e3");            
	EdgeRandom e4  = new EdgeRandom(new double[]{1.0}, open, "e4");
	
	EdgeRandom e5   = new EdgeRandom(new double[] {0.0}, open, "e5");
	EdgeRandom e6   = new EdgeRandom(new double[] {0.0}, open, "e6");
	EdgeRandom e7   = new EdgeRandom(new double[] {0.0}, open, "e7");
	EdgeRandom e8   = new EdgeRandom(new double[] {0.0}, open, "e8");
	
	EdgeRandom e9   = new EdgeRandom(new double[] {   0.0}, new double[] {0.5}, "e9");
	EdgeRandom e10  = new EdgeRandom(new double[] {1000.0}, open,               "e10");
	EdgeRandom e11  = new EdgeRandom(new double[] {   0.0}, new double[] {0.5}, "e11");
	EdgeRandom e12  = new EdgeRandom(new double[] {1000.0}, open,               "e12");
	EdgeRandom e13  = new EdgeRandom(new double[] {   0.0}, new double[] {0.5}, "e13");
	EdgeRandom e14  = new EdgeRandom(new double[] {1000.0}, open,               "e14");
	EdgeRandom e15  = new EdgeRandom(new double[] {   0.0}, new double[] {0.5}, "e15");
	EdgeRandom e16  = new EdgeRandom(new double[] {1000.0}, open,               "e16");
	EdgeRandom e17  = new EdgeRandom(maxCost, open, "e17");
	
	EdgeRandom e18  = new EdgeRandom(noCost, open, "e18");
	EdgeRandom e19  = new EdgeRandom(noCost, open, "e19");
	EdgeRandom e20  = new EdgeRandom(noCost, open, "e20");
	EdgeRandom e21  = new EdgeRandom(noCost, open, "e21");
	EdgeRandom e22  = new EdgeRandom(noCost, open, "e22");
	EdgeRandom e23  = new EdgeRandom(noCost, open, "e23");
	EdgeRandom e24  = new EdgeRandom(noCost, open, "e24");
	EdgeRandom e25  = new EdgeRandom(noCost, open, "e25");
	EdgeRandom e26  = new EdgeRandom(noCost, open, "e26");
	
	randGraph.addEdge(e1, v1, v2);
	randGraph.addEdge(e2, v1, v3);
	randGraph.addEdge(e3, v1, v4);
	randGraph.addEdge(e4, v1, v5);
	
	randGraph.addEdge(e5, v2, v6);
	randGraph.addEdge(e6, v3, v7);
	randGraph.addEdge(e7, v4, v8);
	randGraph.addEdge(e8, v5, v9);
	
	randGraph.addEdge(e9,  v6, v10);
	randGraph.addEdge(e10, v6, v11);
	randGraph.addEdge(e11, v7, v12);
	randGraph.addEdge(e12, v7, v13);
	randGraph.addEdge(e13, v8, v14);
	randGraph.addEdge(e14, v8, v15);                
	randGraph.addEdge(e15, v9, v16);                
	randGraph.addEdge(e16, v9, v17);
	
	randGraph.addEdge(e17, v1, v18);
	
	randGraph.addEdge(e18, v10, v19);               
	randGraph.addEdge(e19, v11, v19);               
	randGraph.addEdge(e20, v12, v19);
	randGraph.addEdge(e21, v13, v19);
	randGraph.addEdge(e22, v14, v19);
	randGraph.addEdge(e23, v15, v19);
	randGraph.addEdge(e24, v16, v19);               
	randGraph.addEdge(e25, v17, v19);               
	randGraph.addEdge(e26, v18, v19);                               
	
	ctpGraph.rollGraph(randGraph);
	ctpGraph.calculateSubtreeProperties(ctpGraph.getStart());
	ctpGraph.populateDGapMap();
	}

	public static void main(String[] args) {
		
		//ctp.initSampleGraph();
		//ctp.initCommitingPolicy();
		//ctp.initNonCommitingPolicy();
		//ctp.initVertexCommitingDisjoint();
		int runningTimes = 1;
		String experiment = "C";
		if (args.length > 0) {
			runningTimes = Integer.parseInt(args[0]);
			experiment = args[1];
		}
		
		int commitCounter = 0;
		System.out.format("run number, max d-gap, max d-ratio, optimal cost, optimal commiting cost, committing\n");
		for (int i = 0; i < runningTimes; i++) {
			CTPMain ctp = new CTPMain();
			
			if (experiment.equals("C")) {
				ctp.initExperimentC();				
			} else if (experiment.equals("D")) {
				ctp.initExperimentD();
			} else if (experiment.equals("E")) {
				ctp.initExperimentE();
			} else if (experiment.equals("E1")) {
				ctp.initExperimentE1();
			} else if (experiment.equals("E2")) {
				ctp.initExperimentE2();
			} else if (experiment.equals("F")) {
				ctp.initExperimentF();
			} else if (experiment.equals("F1")) {
				ctp.initExperimentF1();
			} else if (experiment.equals("F2")) {
				ctp.initExperimentF2();
			} else if (experiment.equals("G1")) {
				ctp.initExperimentG1();
			} else if (experiment.equals("G2")) {
				ctp.initExperimentG2();
			} else if (experiment.equals("H1")) {
				ctp.initExperimentH1();
			} else if (experiment.equals("H2")) {
				ctp.initExperimentH2();
			} else if (experiment.equals("I1")) {
				ctp.initExperimentI1();
			} else if (experiment.equals("I2")) {
				ctp.initExperimentI2();
			} else if (experiment.equals("I3")) {
				ctp.initExperimentI3();
			} else {
				ctp.initExperimentE2Special();
			}
			
			//ctp.initTestTreeSimple();
			//System.out.format("Expected cost of subtree for the root is: %.3f \n", ctp.ctpGraph.getTree().getRoot().expectedCostSubtree);
			//System.out.format("Max d-gap is: %.3f \n", ctp.ctpGraph.maxDGap());
			//System.out.format("Max d-ratio is: %.3f \n", ctp.ctpGraph.maxDRatio());
			//System.out.println(ctp.ctpGraph.graph);
			
			//ctp.ctpGraph.drawGraph();
			//ctp.ctpGraph.drawTree();
			ctp.stGraph.populateGraph();
			//ctp.stGraph.draw();
			
			PolicyBuilder pb = new PolicyBuilder(ctp.stGraph);
			Policy optimalPolicy = pb.buildOptimalPolicy();
			//Policy optimalExploringVerticesPolicy = pb.buildOptimalExploringVerticesPolicy(ctp.ctpGraph.getGraph().getVertices());
			Policy optimalCommitingVerticesPolicy = pb.buildOptimalVerticesCommitingPolicy(ctp.ctpGraph.getGraph().getVertices());
			//optimalPolicy.printInitState();
			//optimalCommitingVerticesPolicy.printInitState();
			//optimalExploringVerticesPolicy.print(true);
			
			//boolean commiting = Policy.isPolicyAllVerticesCommiting(optimalExploringVerticesPolicy, ctp.ctpGraph);
			String committing;
			if (optimalPolicy.getCost() == optimalCommitingVerticesPolicy.getCost()) {
				commitCounter++;
				committing = "c";
			} else {
				committing = "nc";
			}
			
			String isDSubtreeBiggerThanParentCost = "NF";
			if (ctp.ctpGraph.isDSubtreeBiggerThanParentCost()) {
				isDSubtreeBiggerThanParentCost = "F";
			}
			System.out.format("%d, %.3f, %.3f, %.3f, %.3f, %s, %s\n", 
					i, ctp.ctpGraph.maxDGap(), ctp.ctpGraph.maxDRatio(), 
					optimalPolicy.getCost(), optimalCommitingVerticesPolicy.getCost(), committing, 
					isDSubtreeBiggerThanParentCost);
			
			
		}
		System.out.println();
		System.out.format("Commiting ratio: %.3f\n", (double)commitCounter / (double)runningTimes);
	}


}
